<include file="Public:header" />
<style>
	.header{display:none;}
	.w790{margin-top:0px;}
</style>
<div class="container main"> <include file="Public:left" />
  <div class="w790">
  <script>
  	function uploaded(path){
		$("#img_url").attr("src",'__PUBLIC__'+path);
		$("input[name='img_url']").val(path);
	}
	
	function del_img(){
		if(confirm('您确定要删除图片吗?')){
			var file=$("input[name='img_url']").val();
			$.post("{:U('delImgBypath')}",{'path':file},function(data){
				$("input[name='img_url']").val('');
				$("#img_url").attr('src','');
			});
		}else{
			return false;
		}
	}
	//删除图组图片
	function mdel_img(path){
		$('#img_list div img').each(function(index, element) {
			$.post("{:U('delImgBypath')}",{'path':path},function(data){
				
					
					$('#img_list div').each(function(index, element) {
                        if($(this).attr('url')==path){
							$(this).remove();
						}
                    });
					
					$('#picmsg input').each(function(index, element) {
                        if($(this).val()==path){
							$(this).remove();
						}
                    });
			
			});
		});
	}
	
	
	$(document).ready(function(e) {
    $('#control li').each(function(index, element) {
        $(this).click(function(e) {
			$(this).parent().find('li').removeClass('cur');
            $(this).addClass('cur');
			$('.setting_table').hide();
			$('.setting_table').eq(index).show();
        });
    });
});
function relateListadd(id,title,cate_name){
	//防止重复
	if(!$('#relateList input[value="'+id+'"]').length>0){
		$('<li>'+id+'<input type="hidden" name="relateid[]" value="'+id+'" /><input type="hidden" name="relatecate_name[]" value="'+cate_name+'" /><input size="70" type="text" name="relatetitle[]" value="'+title+'" /><a href="javascript:void(0);" onclick="after(this);">上</a><a href="javascript:void(0);" onclick="append(this);">下</a><span id="relateListdel'+id+'" class="relateListdel" onclick="relateListdel('+id+');">×</span></li>').appendTo('#relateList');
	}
}
function after(e){
	$(e).parent('li').after($(e).parent('li').prev());
}
function append(e){
	$(e).parent('li').next().after($(e).parent('li'));
}
function relateListdel(id){
	$('#relateListdel'+id).parent('li').remove();
}
function showRelate(){
			    art.dialog.open('{:U('News/relate')}', {width: 600, height: 400, ok:function(){
					
				}});
			}
  </script>
  <h1><a href="{:U('index')}">返回列表</a><eq name="category['name']" value=""><else/>-添加"{$category['title']}"列表数据</eq></h1>
  
  <!--扩展切换-->
  <style>
		#control li{float:left; height:40px; line-height:40px; border:1px solid #558fca; border-bottom:none;}
		#control li a{padding:0px 8px;}
		#control li.cur{background:#558fca;}
		#control li.cur a{color:#fff; font-weight:bold;}
		.relateListdel{display:inline-block; width:20px; height:20px; text-align:center; font-size:18px; cursor:default;}
	</style>
   <ul id="control">
   <volist name="extendsField" id="vo">
   	<li><a href="javascript:void(0);">{$field.name}</a></li>
   </volist>
   <div class="clear"></div>
   </ul>
  <!---->
  <input type="hidden" name="is_list" value="1" />
      <div class="table_"><table class="table table-bordered" width="100%" border="0" cellspacing="0" class="setting_table" cellpadding="0">
      <tr>
        <td align="right">字段名称</td>
        <td>
        <input datatype="*" disabled="disabled" name="name" value="{$field.name}" type="text" id="name" size="70" style="width:120px;"></td>
        <td>&nbsp;</td>
      </tr> 
      <tr>
        <td align="right">字段类型</td>
        <td>
        <input datatype="*" disabled="disabled" name="type" value="{$field.type}" type="text" id="type" size="70" style="width:120px;"></td>
        <td>&nbsp;</td>
      </tr> 
      <tr>
        <td align="right">字段长度</td>
        <td>
        <input datatype="*" disabled="disabled" name="length" value="{$field.length}" type="text" id="length" size="70" style="width:120px;"></td>
        <td>&nbsp;</td>
      </tr> 
      <tr>
        <td align="right">验证规则</td>
        <td>
        <input datatype="*" disabled="disabled" name="verify" value="{$field.verify}" type="text" id="verify" size="70"  style="width:120px;"></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3" align="left"><div id="img_list"></div></td>
      </tr>
     </table>
      
      <!--扩展开始-->
      <volist name="extendsField" id="vo">
     <table class="table table-bordered" class="setting_table" width="100%" border="0" style="display:none;" cellspacing="0" cellpadding="0">
<volist name="vo['list']" id="svo">
  <tr class="data_list">
  <td align="right">{$svo.remark}</td>
  <td>
  <!--单行文本框-->
    <eq name="svo['type']" value="0">
        <input name="extendsField[{$svo.name}]" value="{$extendsField[$svo['name']]}" type="text" />
    </eq>
  <!--下拉框-->
    <eq name="svo['type']" value="2">
        <html:select name="extendsField[{$svo['name']}]" options="svo['_select']" selected="extendsField[$svo['name']]" />
    </eq>
    <!--编辑框-->
    <eq name="svo['type']" value="3">
        <html:editor id="{$svo['name']}_" name="extendsField[{$svo['name']}]" type="UEDIT" style="width:100%;">{$extendsField[$svo['name']]}</html:editor>
    </eq>
    <!--多行文本-->
    <eq name="svo['type']" value="1">
        <textarea name="extendsField[{$svo.name}]" cols="60" rows="6">{$extendsField[$svo['name']]}</textarea>
    </eq>
    <!--上传图片-->
    <eq name="svo['type']" value="4">
        <script>
			function uploaded{$svo.name}(path,name){
				$("#"+name).attr("src",'__PUBLIC__'+path);
				$("input[name='extendsField["+name+"]']").val(path);
			}
			function del_img{$svo.name}(name){
				if(confirm('您确定要删除图片吗?')){
					var file=$("input[name='extendsField["+name+"]']").val();
					$.post("{:U('delImgBypath')}",{'path':file},function(data){
						$("input[name='extendsField["+name+"]']").val('');
						$("#"+name).attr('src','');
					});
				}else{
					return false;
				}
			}
			
		</script>
        <input type="hidden" name="extendsField[{$svo.name}]" value="{$extendsField[$svo['name']]}" />
        <iframe frameborder="0" width="400" height="40" scrolling="no" src="{:U('upload',array('name'=>$svo['name']))}"></iframe>
        <img src="{:getThumbPath($extendsField[$svo['name']])}" id="{$svo.name}" height="80" /><a href="javascript:void(0);" onclick="del_img{$svo.name}('{$svo.name}');">删除</a>
    </eq>
    <!--图片上传结束-->
    </td>
  </tr>
</volist>
</table>

</volist></div>
      <!--扩展结束-->
      
  </div>
  <div class="clear"></div>
</div>

</body></html>